local zishucup__jiaoxia = fk.CreateSkill{
  name = "zishucup__jiaoxia",
}

Fk:loadTranslationTable{
  ["zishucup__jiaoxia"] = "骄黠",
  [":zishucup__jiaoxia"] = "每轮限四次，你可以视为使用或打出【杀】，或可以消耗所有剩余次数以视为使用【兵临城下】。",

  ["#zishucup__jiaoxia-viewas"] = "骄黠：你可以消耗一次计数，视为使用或打出【杀】，或消耗所有剩余计数以视为使用【兵临城下】",

  ["$zishucup__jiaoxia1"] = "昔什邡投魏弃汉，我联吴背蜀、有何不可！",
  ["$zishucup__jiaoxia2"] = "效先祖雍齿，以叛汉得厚赏！",
}

zishucup__jiaoxia:addEffect("viewas", {
  anim_type = "offensive",
  prompt = "#zishucup__jiaoxia-viewas",
  pattern = "slash,enemy_at_the_gates",
  card_filter = Util.FalseFunc,
  times = function (self, player)
    return  4 - player:usedSkillTimes(zishucup__jiaoxia.name, Player.HistoryRound)
  end,
  interaction = function(self, player)
    local all_names = {"slash","enemy_at_the_gates"}
    local names = player:getViewAsCardNames(zishucup__jiaoxia.name, all_names)
    if #names > 0 then
      return UI.ComboBox { choices = names, all_choices = all_names }
    end
  end,
  view_as = function(self, player, cards)
    if not self.interaction.data then return end
    local card = Fk:cloneCard(self.interaction.data)
    card.skillName = zishucup__jiaoxia.name
    return card
  end,
  before_use = function(self, player, use)
    if use.card.name == "enemy_at_the_gates" then
      player:setSkillUseHistory(zishucup__jiaoxia.name, 4, Player.HistoryRound)
    end
  end,
  enabled_at_play = function(self, player)
    return 4 - player:usedSkillTimes(zishucup__jiaoxia.name, Player.HistoryRound) > 0
  end,
  enabled_at_response = function(self, player, response)
    local pat = Fk.currentResponsePattern
    if response and pat and 4 - player:usedSkillTimes(zishucup__jiaoxia.name, Player.HistoryRound) > 0 then
      return Exppattern:Parse(pat):matchExp("slash")
    else
      return not response and pat and 4 - player:usedSkillTimes(zishucup__jiaoxia.name, Player.HistoryRound) > 0
      and (Exppattern:Parse(pat):matchExp("slash") or Exppattern:Parse(pat):matchExp("enemy_at_the_gates"))
    end
  end,
})

return zishucup__jiaoxia
